﻿@model IEnumerable<XHouse.Model.Aparatos.Aparato>

@{
    ViewBag.Title = "Aparatos";
}


<div class="row">
  <div class="col-xs-12 col-md-10 col-md-offset-1">

    <h2>Aparatos</h2>

    <a class="btn btn-success white mt20 mb20" href="@Url.Action("Create", "Aparatos")">
      <span class="glyphicon glyphicon-plus"></span> Nuevo Aparato
    </a>

    <table class="table table-striped">
      <thead>
          <tr>
              <th>Número</th>
              <th>Nombre</th>
              <th>Descripción</th>
              <th>Habilitado</th>
              <th>Tipo</th>
              <th>Zona</th>
              <th>Módulo</th>
              <th>Ambiente</th>
              <th>Estado</th>
          </tr>
      </thead>
      <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>@Html.DisplayFor(modelItem => item.Numero)</td>
                <td>@Html.DisplayFor(modelItem => item.Nombre)</td>
                <td>@Html.DisplayFor(modelItem => item.Descripcion)</td>
                <td>@Html.DisplayFor(modelItem => item.Habilitado)</td>
                <td>@Html.DisplayFor(modelItem => item.TipoAparato.Nombre)</td>
                <td>@Html.DisplayFor(modelItem => item.Zona.Nombre)</td>
                <td>@Html.DisplayFor(modelItem => item.Modulo.Nombre)</td>
                <td>@Html.DisplayFor(modelItem => item.Ambiente.Nombre)</td>
                <td>@Html.DisplayFor(modelItem => item.EstadoActual)</td>
                <td>
                    <a class="btn btn-info btn-xs white" href="@Url.Action("Edit", "Aparatos", new { id = item.Id })">
                        <span class="glyphicon glyphicon-pencil"></span> Editar
                    </a>
                    
                    <a class="btn btn-danger btn-xs white" onclick="return confirm('¿Esta seguro que desea eliminar el Aparato?');" href="@Url.Action("Delete", "Aparatos", new { id = item.Id })">
                        <span class="glyphicon glyphicon-remove"></span> Eliminar
                    </a>
                </td>
            </tr>
        }
      </tbody>
    </table>

  </div>
</div>